home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / misc / emu / ATUtilities.lha / ATUtilities / gb.c < prev    next >
C/C++ Source or Header  |  2000-09-26  |  33KB  |  1,363 lines

  1. /* ******************************************************************* */
  2. /* **                                                               ** */
  3. /* **                     ATUtilities HiFi-Player                   ** */
  4. /* **            Copright (C) 1992-1993 by Thomas Dreibholz         ** */
  5. /* **                      All rights reserved                      ** */
  6. /* **                                                               ** */
  7. /* ******************************************************************* */
  8.  
  9. #include "ATUtilities.h"
  10. #include "HiFi.h"
  11.  
  12. UBYTE *HelpName="M:xy";
  13.  
  14. #define MAXTITLES 250
  15. #define CATSIZE (2+(MAXTITLES*128))
  16.  
  17. struct Catalog
  18. {
  19.  UWORD Entries;
  20.  UBYTE Title[1][128];
  21. } *Catalog,*Cat2;
  22.  
  23. struct PlayerList
  24. {
  25.  UWORD Entries;
  26.  UBYTE Name[100][128];
  27. } PlayerList=
  28. {
  29.  3,
  30.  "M:DeliPlayers",
  31.  "IFF-SMUS",
  32.  "IFF-8SVX",
  33.  "MarkII"
  34. };
  35.  
  36. struct Interrupt MyInt;
  37.  
  38. struct Library   *GfxBase;
  39. struct Library   *IntuitionBase;
  40. struct Library   *ATUtilitiesBase;
  41. struct Library   *AslBase;
  42. struct Library   *UtilityBase;
  43. struct Library   *GadToolsBase;
  44. extern struct Library *SysBase;
  45. extern struct Library *DOSBase;
  46.  
  47. struct Task     *Task;
  48. struct TextFont *opal;
  49. struct Window   *HCWindow;
  50. struct Screen   *HCScreen;
  51. struct RastPort *HCRPort;
  52. struct ViewPort *HCViewPort;
  53.  
  54. struct TagItem       *ReqTags;
  55. struct FileRequester *FileReq;
  56. struct WBArg         *fargs;
  57. struct Lock          *lock;
  58. UBYTE                 dir[130];
  59.  
  60. struct NewScreen HCScreenDef=
  61. {
  62.  0,210,640,45,2,
  63.  0,1,HIRES,CUSTOMSCREEN,
  64.  0,0,0,0
  65. };
  66.  
  67. struct NewWindow HCWindowDef=
  68. {
  69.  0,0,640,45,0,1,
  70.  0L,BORDERLESS,
  71.  0L,0L,0L,0L,0L,
  72.  50,50,640,100,
  73.  CUSTOMSCREEN
  74. };
  75.  
  76. LONG  PortSignal;
  77. ULONG PortSignalMask;
  78. ULONG WaitSignalMask;
  79. ULONG Signale;
  80.  
  81. VOID HiFiControl();
  82. VOID StopSymbol();
  83. VOID WaitSymbol();
  84. VOID PlaySymbol();
  85. VOID ShowPlayer();
  86. VOID ShowSTitle();
  87. VOID ShowVolume();
  88. VOID ShowInfo();
  89. VOID OpenAll();
  90. VOID CloseAll();
  91. VOID PlayerPrefs();
  92. VOID TitleEd();
  93. VOID LoadCatalog();
  94. VOID SaveCatalog();
  95. BOOL AuPrefs();
  96.  
  97. struct MsgPort  *Port;
  98.  
  99. struct Global
  100. {
  101.  APTR AslBase;
  102.  APTR DOSBase;
  103.  APTR IntuitionBase;
  104.  APTR GfxBase;
  105.  APTR GadToolsBase;
  106.  APTR ReservedLibraryBase;
  107.  APTR DirArrayPtr;
  108.  APTR FileArrayPtr;
  109.  APTR PathArrayPtr;
  110.  APTR  ChkData;
  111.  ULONG ChkSize;
  112.  UWORD SndNum;
  113.  UWORD SndVol;
  114.  UWORD SndLBal;
  115.  UWORD SndRBal;
  116.  UWORD LED;
  117.  UWORD Timer;
  118.  VOID (* GetListData)();
  119.  VOID (* LoadFile)();
  120.  VOID (* CopyDir)();
  121.  VOID (* CopyFile)();
  122.  VOID (* CopyString)();
  123.  VOID (* AudioAlloc)();
  124.  VOID (* AudioFree)();
  125.  
  126.  VOID (* StartInt)();
  127.  VOID (* StopInt)();
  128.  VOID (* SongEnd)();
  129.  VOID (* CutSuffix)();
  130.  VOID (* SetTimer)();
  131.  
  132.  APTR R1,R2,R3;
  133. } Global;
  134.  
  135. struct DOSSegment
  136. {
  137.  BPTR  NextSegment;
  138.  ULONG RTS;
  139.  UBYTE ID[8];
  140.  APTR  TagArray;
  141. };
  142. struct Tag
  143. {
  144.  ULONG Code;
  145.  ULONG Data;
  146. } *Tags;
  147.  
  148. struct DOSSegment *Segmente[200];
  149. BPTR               Player[200];
  150. UWORD              PlayerCnt;
  151.  
  152. #define TAG_USER    0x80000000
  153. #define TAG_DONE    0
  154. #define TAG_IGNORE  1
  155. #define DPT_TagBase (ULONG)((ULONG)TAG_USER+(ULONG)((UWORD)'DT'))
  156.  
  157. #define DPT_InternalPlayer    DPT_TagBase+0
  158. #define DPT_CustomPlayer      DPT_TagBase+1
  159. #define DPT_RequestDTVersion  DPT_TagBase+2
  160. #define DPT_RequestV37        DPT_TagBase+3
  161. #define DPT_PlayerVersion     DPT_TagBase+4
  162. #define DPT_PlayerName        DPT_TagBase+5
  163. #define DPT_Creator           DPT_TagBase+6
  164. #define DPT_Check1            DPT_TagBase+7
  165. #define DPT_Check2            DPT_TagBase+8
  166. #define DPT_ExtLoad           DPT_TagBase+9
  167. #define DPT_Interrupt         DPT_TagBase+10
  168. #define DPT_Stop              DPT_TagBase+11
  169. #define DPT_Config            DPT_TagBase+12
  170. #define DPT_UserConfig        DPT_TagBase+13
  171. #define DPT_SubSoundRange     DPT_TagBase+14
  172. #define DPT_InitPlayer        DPT_TagBase+15
  173. #define DPT_EndPlayer         DPT_TagBase+16
  174. #define DPT_InitSound         DPT_TagBase+17
  175. #define DPT_EndSound          DPT_TagBase+18
  176. #define DPT_StartInt          DPT_TagBase+19
  177. #define DPT_StopInt           DPT_TagBase+20
  178. #define DPT_Volume            DPT_TagBase+21
  179. #define DPT_Balance           DPT_TagBase+22
  180. #define DPT_Faster            DPT_TagBase+23
  181. #define DPT_Slower            DPT_TagBase+24
  182. #define DPT_NextPatt          DPT_TagBase+25
  183. #define DPT_PrevPatt          DPT_TagBase+26
  184. #define DPT_NextSong          DPT_TagBase+27
  185. #define DPT_PrevSong          DPT_TagBase+28
  186. #define DPT_SubSongTest       DPT_TagBase+29
  187.  
  188. WORD CallCheck1(),CallCheck2();
  189.  
  190. VOID xGetListData();
  191. VOID xLoadFile();
  192. VOID xCopyDir();
  193. VOID xCopyFile();
  194. VOID xCopyString();
  195. VOID xAudioAlloc();
  196. VOID xAudioFree();
  197. VOID xStartInt();
  198. VOID xStopInt();
  199. VOID xSongEnd();
  200. VOID xCutSuffix();
  201. VOID xSetTimer();
  202.  
  203. APTR InitPlayer;
  204. APTR EndPlayer;
  205. APTR InitSound;
  206. APTR EndSound;
  207. APTR Interrupt;
  208. APTR StartInt;
  209. APTR StopInt;
  210. APTR Check1;
  211. APTR Check2;
  212. APTR Volume;
  213.  
  214. UBYTE *mem;
  215. UBYTE *pname;
  216. ULONG  size;
  217. UWORD  current;
  218. BOOL   play;
  219.  
  220. BOOL Start();
  221. VOID Stop();
  222. VOID LoadPlayer();
  223. VOID UnLoadPlayers();
  224.  
  225.  
  226. /* Installationsroutine */
  227. VOID main()
  228. {
  229.  REGISTER LONG         i,j,k,l;
  230.  REGISTER BOOL         bool;
  231.  
  232.  OpenAll();
  233.  bool=FALSE;
  234.  play=FALSE;
  235.  current=0;
  236.  if(HiFiPrefs.Control!=0) HiFiControl();
  237.  while(bool==FALSE)
  238.   {
  239.    Signale=Wait(WaitSignalMask);
  240.    if(Signale & PortSignalMask)
  241.     {
  242.      i=Received(Port);
  243.      switch(i)
  244.       {
  245.        case UTILITY_QUIT:
  246.          DisplayBeep(NULL);
  247.          if(HCScreen!=NULL) HiFiControl();
  248.          bool=TRUE;
  249.         break;
  250.        case UTILITY_HELP:
  251.          Help(HelpName,0);
  252.         break;
  253.        case UTILITY_INFO:
  254.          Stop();
  255.          ShowInfo();
  256.         break;
  257.        case 1100:
  258.          if(play==FALSE)
  259.           {
  260.            current=0;
  261.            play=Start(current);
  262.            if(play==FALSE) Stop();
  263.           }
  264.         break;
  265.        case 1001:
  266.          if(play==FALSE)
  267.           {
  268.            play=Start(current);
  269.            if(play==FALSE) Stop();
  270.           }
  271.         break;
  272.        case 1002:
  273.          Stop();
  274.          play=FALSE;
  275.         break;
  276.        case 1003:
  277.          Stop();
  278.          current=0;
  279.          play=Start(0);
  280.          if(play==FALSE) Stop();
  281.         break;
  282.        case 1004:
  283.          Stop();
  284.          current=Catalog->Entries-1;
  285.          play=Start(current);
  286.          if(play==FALSE) Stop();
  287.         break;
  288.        case 1005:
  289.          Stop();
  290.          current=current+1;
  291.          if(current==Catalog->Entries) current=0;
  292.          play=Start(current);
  293.          if(play==FALSE) Stop();
  294.         break;
  295.        case 1006:
  296.          Stop();
  297.          if(current>0) current=current-1; else current=Catalog->Entries-1;
  298.          play=Start(current);
  299.          if(play==FALSE) Stop();
  300.         break;
  301.        case 1007:
  302.          if(play) Stop();
  303.          TitleEd();
  304.          play=FALSE;
  305.          current=0;
  306.         break;
  307.        case 1008:
  308.          if(play) Stop();
  309.          LoadCatalog(NULL);
  310.          play=FALSE;
  311.          current=0;
  312.         break;
  313.        case 1009:
  314.          if(play) Stop();
  315.          SaveCatalog();
  316.          if(play)
  317.           {
  318.            play=Start(current);
  319.            if(play==FALSE) Stop();
  320.           }
  321.         break;
  322.        case UTILITY_CALL:
  323.        case 1010:
  324.          if(play) Stop();
  325.          bool=AuPrefs();
  326.          if(play)
  327.           {
  328.            play=Start(current);
  329.            if(play==FALSE) Stop();
  330.           }
  331.         break;
  332.        case 1011:
  333.          if(play) Stop();
  334.          PlayerPrefs();
  335.          if(play)
  336.           {
  337.            play=Start(current);
  338.            if(play==FALSE) Stop();
  339.           }
  340.         break;
  341.        case 1012:
  342.          HiFiControl();
  343.         break;
  344.        case 1013:
  345.          if(Global.SndVol<=62) Global.SndVol+=2;
  346.          if((play)&&(Volume))
  347.            CallVolume();
  348.          ShowVolume();
  349.         break;
  350.        case 1014:
  351.          if(Global.SndVol>=2) Global.SndVol-=2;
  352.          if((play)&&(Volume))
  353.            CallVolume();
  354.          ShowVolume();
  355.         break;
  356.       }
  357.     }
  358.   }
  359.  Stop();
  360.  CloseAll();
  361. }
  362.  
  363.  
  364. /* Installationsroutine */
  365. VOID OpenAll()
  366. {
  367.  REGISTER UWORD              i;
  368.  register struct MsgPort    *p;
  369.  register struct FileHandle *fh;
  370.  
  371.  p=FindPort(HiFiPort);
  372.  if(p!=NULL)
  373.   {
  374.    InfoRequest("ATUtilities HiFi-Player ist schon aktiv.");
  375.    CloseAll();
  376.   }
  377.  
  378.  ATUtilitiesBase=OpenLibrary("at-utilities.library",0L);
  379.  if(ATUtilitiesBase==NULL)
  380.   {
  381.    printf("FEHLER: Kann ATUtilities-Library nicht öffnen.\n");
  382.    CloseAll();
  383.   }
  384.  
  385.  if((SysBase->lib_Version<36)||(DOSBase->lib_Version<36))
  386.   {
  387.    InfoRequest("HiFi-Player benötigt Kickstart 2.0!");
  388.    CloseAll();
  389.   }
  390.  
  391.  Task=FindTask(NULL);
  392.  
  393.  GfxBase=OpenLibrary("graphics.library",0L);
  394.  IntuitionBase=OpenLibrary("intuition.library",0L);
  395.  if((GfxBase==NULL)||(IntuitionBase==NULL))
  396.   {
  397.    CloseAll();
  398.   }
  399.  
  400.  AslBase=OpenLibrary("asl.library",0L);
  401.  if(AslBase==NULL)
  402.   {
  403.    InfoRequest("Konnte Asl-Library nicht laden.");
  404.    CloseAll();
  405.   }
  406.  
  407.  GadToolsBase=OpenLibrary("gadtools.library",0L);
  408.  if(GadToolsBase==NULL)
  409.   {
  410.    InfoRequest("Konnte GadTools-Library nicht laden.");
  411.    CloseAll();
  412.   }
  413.  
  414.  UtilityBase=OpenLibrary("utility.library",0L);
  415.  if(UtilityBase==NULL)
  416.   {
  417.    InfoRequest("Konnte Utility-Library nicht laden.");
  418.    CloseAll();
  419.   }
  420.  
  421.  opal=GetOpalFont();
  422.  
  423.  Port=CreatePort(HiFiPort,0L);
  424.  if(Port==NULL)
  425.   {
  426.    ErrorRequest(ERROR_MPORT);
  427.    CloseAll();
  428.   }
  429.  
  430.  fh=Open(HiFiPrefsName,MODE_OLDFILE);
  431.  if(fh!=NULL)
  432.   {
  433.    Read(fh,&HiFiPrefs,sizeof(struct HiFiPrefs));
  434.    Close(fh);
  435.   }
  436.  
  437.  Catalog=AllocMem(CATSIZE*2,MEMF_CLEAR|MEMF_PUBLIC);
  438.  if(Catalog==NULL)
  439.   {
  440.    ErrorRequest(ERROR_ALLOC);
  441.    CloseAll();
  442.   }
  443.  Cat2=(ULONG)Catalog+(ULONG)CATSIZE;
  444.  
  445.  ReqTags=AllocateTagItems(6L);
  446.  if(ReqTags==NULL)
  447.   {
  448.    InfoRequest("Kein Speicher für Tag-Items!\n");
  449.    CloseAll();
  450.   }
  451.  
  452.  ReqTags[0].ti_Tag=ASL_Pattern;
  453.  ReqTags[0].ti_Data="#?";
  454.  
  455.  ReqTags[1].ti_Tag=ASL_FuncFlags;
  456.  ReqTags[1].ti_Data=FILF_MULTISELECT|FILF_PATGAD;
  457.  
  458.  ReqTags[2].ti_Tag=ASL_Hail;
  459.  ReqTags[2].ti_Data="HiFi-Player - Dateiauswahl";
  460.  
  461.  ReqTags[3].ti_Tag=TAG_DONE;
  462.  ReqTags[4].ti_Tag=TAG_DONE;
  463.  ReqTags[5].ti_Tag=TAG_DONE;
  464.  
  465.  FileReq=AllocAslRequest(ASL_FileRequest,NULL);
  466.  if(FileReq==NULL)
  467.   {
  468.    InfoRequest("Kein Speicher für ASL-Requester!");
  469.    CloseAll();
  470.   }
  471.  
  472.  PortSignal=Port->mp_SigBit;
  473.  PortSignalMask=(1L<<PortSignal);
  474.  WaitSignalMask=PortSignalMask;
  475.  ChangeTaskPri(10);
  476.  
  477.  Global.AslBase=AslBase;
  478.  Global.DOSBase=DOSBase;
  479.  Global.IntuitionBase=IntuitionBase;
  480.  Global.GfxBase=GfxBase;
  481.  Global.GadToolsBase=GadToolsBase;
  482.  Global.SndNum=0;
  483.  Global.SndVol=HiFiPrefs.Volume;
  484.  Global.SndLBal=HiFiPrefs.LBal;
  485.  Global.SndRBal=HiFiPrefs.RBal;
  486.  Global.LED=1;
  487.  Global.Timer=SysBase->VBlankFrequency;
  488.  Global.GetListData=(VOID *)xGetListData;
  489.  Global.LoadFile=(VOID *)xLoadFile;
  490.  Global.CopyDir=(VOID *)xCopyDir;
  491.  Global.CopyFile=(VOID *)xCopyFile;
  492.  Global.CopyString=(VOID *)xCopyString;
  493.  Global.AudioAlloc=(VOID *)xAudioAlloc;
  494.  Global.AudioFree=(VOID *)xAudioFree;
  495.  Global.StartInt=(VOID *)xStartInt;
  496.  Global.StopInt=(VOID *)xStopInt;
  497.  Global.SongEnd=(VOID *)xSongEnd;
  498.  Global.CutSuffix=(VOID *)xCutSuffix;
  499.  Global.SetTimer=(VOID *)xSetTimer;
  500.  MyInt.is_Node.ln_Succ=NULL;
  501.  MyInt.is_Node.ln_Pred=NULL;
  502.  MyInt.is_Node.ln_Pri=0;
  503.  MyInt.is_Node.ln_Type=NT_INTERRUPT;
  504.  MyInt.is_Node.ln_Name="hifiplayer.interrupt";
  505.  MyInt.is_Data=&Global;
  506.  LoadPlayer("M:DeliPlayers/IFF-SMUS");
  507.  LoadPlayer("M:DeliPlayers/IFF-8SVX");
  508.  LoadPlayer("M:DeliPlayers/MarkII");
  509.  LoadCatalog(&HiFiPrefs.DefaultCatalog);
  510. }
  511.  
  512.  
  513. /* Programmende */
  514. VOID CloseAll()
  515. {
  516.  UnLoadPlayers();
  517.  if(HCScreen!=NULL) HiFiControl();
  518.  if(Port) DeletePort(Port);
  519.  if(ReqTags) FreeTagItems(ReqTags);
  520.  if(FileReq) FreeAslRequest(FileReq);
  521.  if(Catalog) FreeMem(Catalog,CATSIZE*2);
  522.  if(ATUtilitiesBase) CloseLibrary(ATUtilitiesBase);
  523.  if(GfxBase) CloseLibrary(GfxBase);
  524.  if(IntuitionBase) CloseLibrary(IntuitionBase);
  525.  if(UtilityBase) CloseLibrary(UtilityBase);
  526.  if(GadToolsBase) CloseLibrary(GadToolsBase);
  527.  if(AslBase) CloseLibrary(AslBase);
  528.  exit(0);
  529. }
  530.  
  531.  
  532. /* Katalog laden */
  533. VOID LoadCatalog(name)
  534.  UBYTE *name;
  535. {
  536.  Catalog->Entries=16;
  537.  strcpy(&Catalog->Title[0],"DH0:Musik/Scores/Aegis Sonix/Strings.smus");
  538.  strcpy(&Catalog->Title[1],"DH0:Musik/Scores/Aegis Sonix/The End.smus");
  539.  strcpy(&Catalog->Title[2],"DH0:Musik/Scores/Aegis Sonix/The last Fighter.smus");
  540.  strcpy(&Catalog->Title[3],"DH0:Musik/Scores/Aegis Sonix/On the Mars.smus");
  541.  strcpy(&Catalog->Title[4],"DH0:Musik/Scores/Aegis Sonix/Liveless.smus");
  542.  strcpy(&Catalog->Title[5],"DH0:Musik/Scores/Aegis Sonix/Here I am.smus");
  543.  strcpy(&Catalog->Title[6],"DH0:Musik/Scores/Aegis Sonix/Begleitung.smus");
  544.  strcpy(&Catalog->Title[7],"DH0:Musik/Scores/Aegis Sonix/Danger Planet.smus");
  545.  strcpy(&Catalog->Title[8],"DH0:Musik/Scores/Aegis Sonix/Strings.smus");
  546.  strcpy(&Catalog->Title[9],"DH0:Musik/Scores/Aegis Sonix/The End.smus");
  547.  strcpy(&Catalog->Title[10],"DH0:Musik/Scores/Aegis Sonix/The last Fighter.smus");
  548.  strcpy(&Catalog->Title[11],"DH0:Musik/Scores/Aegis Sonix/On the Mars.smus");
  549.  strcpy(&Catalog->Title[12],"DH0:Musik/Scores/Aegis Sonix/Liveless.smus");
  550.  strcpy(&Catalog->Title[13],"DH0:Musik/Scores/Aegis Sonix/Here I am.smus");
  551.  strcpy(&Catalog->Title[14],"DH0:Musik/Scores/Aegis Sonix/Begleitung.smus");
  552.  strcpy(&Catalog->Title[15],"DH0:Musik/Scores/Aegis Sonix/Danger Planet.smus");
  553. }
  554.  
  555.  
  556. /* Katalog laden */
  557. VOID SaveCatalog()
  558. {
  559.  REGISTER UWORD              i;
  560.  register struct FileHandle *fh;
  561.  
  562.  ReqTags[1].Data=FILF_PATGAD|FILF_SAVE;
  563.  if(AslRequest(FileReq,ReqTags))
  564.   {
  565.    fargs=FileReq->rf_ArgList;
  566.    lock=fargs->wa_Lock;
  567.    NameFromLock(lock,&dir,80);
  568.    i=strlen(&dir)-1;
  569.    if(dir[i]!=':') { dir[i+1]='/'; dir[i+2]=0x00; }
  570.    strcat(&dir,fargs->wa_Name);
  571.    printf("%s\n",&dir);
  572.  
  573.    fh=Open(&dir,MODE_NEWFILE);
  574.    if(fh!=NULL)
  575.     {
  576.      Write(fh,Catalog,CATSIZE);
  577.      Close(fh);
  578.     }
  579.    else
  580.     {
  581.      MultiRequest("Datei konnte nicht erstellt werden:",
  582.                   &dir,"Okay",NULL);
  583.     }
  584.   }
  585. }
  586.  
  587.  
  588. /* Information */
  589. VOID ShowInfo()
  590. {
  591.  InformationBox("ATUtilities HiFi-Player - Information",
  592.                 "HiFi-Player - Version 1.0",
  593.                 "Copyright (C) 1993 by",
  594.                 "Thomas Dreibholz",
  595.                 "All rights reserved.",
  596.                 "SYS:PC/ATUtilities/Icons/HiFi");
  597. }
  598.  
  599. #asm
  600.    public _xGetListData
  601. _xGetListData:
  602.    move.l _mem,a0
  603.    move.l _size,d0
  604.    rts
  605.  
  606.    public _xAudioAlloc
  607. _xAudioAlloc:
  608.    clr.l d0
  609.    rts
  610.  
  611.    public _xLoadFile
  612. _xLoadFile:
  613.    clr.l d0
  614.    rts
  615.  
  616.    public _xAudioFree
  617. _xAudioFree:
  618.    rts
  619.  
  620.    public _xStartInt
  621. _xStartInt:
  622.    rts
  623.  
  624.    public _xStopInt
  625. _xStopInt:
  626.    rts
  627. #endasm
  628.  
  629. VOID xCopyDir()
  630. {
  631. }
  632.  
  633. VOID xCopyFile()
  634. {
  635. }
  636.  
  637. VOID xCopyString()
  638. {
  639. }
  640.  
  641. VOID xSetTimer()
  642. {
  643. }
  644.  
  645. VOID xCutSuffix()
  646. {
  647. }
  648.  
  649. VOID xSongEnd()
  650. {
  651.  geta4();
  652.  Utility(HiFiPort,1005);
  653. }
  654.  
  655. #asm
  656.    public _CallInitPlayer
  657. _CallInitPlayer:
  658.    movem.l d1-d7/a0-a6,-(sp)
  659.    move.l #_Global,a5
  660.    move.l _InitPlayer,a0
  661.    jsr (a0)
  662.    movem.l (sp)+,d1-d7/a0-a6
  663.    rts
  664.  
  665.    public _CallEndPlayer
  666. _CallEndPlayer:
  667.    movem.l d1-d7/a0-a6,-(sp)
  668.    move.l #_Global,a5
  669.    move.l _EndPlayer,a0
  670.    jsr (a0)
  671.    movem.l (sp)+,d1-d7/a0-a6
  672.    rts
  673.  
  674.    public _CallStartInt
  675. _CallStartInt:
  676.    movem.l d1-d7/a0-a6,-(sp)
  677.    move.l #_Global,a5
  678.    move.l _StartInt,a0
  679.    jsr (a0)
  680.    movem.l (sp)+,d1-d7/a0-a6
  681.    rts
  682.  
  683.    public _CallStopInt
  684. _CallStopInt:
  685.    movem.l d1-d7/a0-a6,-(sp)
  686.    move.l #_Global,a5
  687.    move.l _StopInt,a0
  688.    jsr (a0)
  689.    movem.l (sp)+,d1-d7/a0-a6
  690.    rts
  691.  
  692.    public _CallInitSound
  693. _CallInitSound:
  694.    movem.l d1-d7/a0-a6,-(sp)
  695.    move.l #_Global,a5
  696.    move.l _InitSound,a0
  697.    jsr (a0)
  698.    movem.l (sp)+,d1-d7/a0-a6
  699.    rts
  700.  
  701.    public _CallEndSound
  702. _CallEndSound:
  703.    movem.l d1-d7/a0-a6,-(sp)
  704.    move.l #_Global,a5
  705.    move.l _EndSound,a0
  706.    jsr (a0)
  707.    movem.l (sp)+,d1-d7/a0-a6
  708.    rts
  709.  
  710.    public _CallVolume
  711. _CallVolume:
  712.    movem.l d1-d7/a0-a6,-(sp)
  713.    move.l #_Global,a5
  714.    move.l _Volume,a0
  715.    jsr (a0)
  716.    movem.l (sp)+,d1-d7/a0-a6
  717.    rts
  718.  
  719.    public _CallCheck1
  720. _CallCheck1:
  721.    movem.l d1-d7/a0-a6,-(sp)
  722.    move.l #_Global,a5
  723.    move.l _Check1,a0
  724.    jsr (a0)
  725.    movem.l (sp)+,d1-d7/a0-a6
  726.    rts
  727.  
  728.    public _CallCheck2
  729. _CallCheck2:
  730.    movem.l d1-d7/a0-a6,-(sp)
  731.    move.l #_Global,a5
  732.    move.l _Check2,a0
  733.    jsr (a0)
  734.    movem.l (sp)+,d1-d7/a0-a6
  735.    rts
  736.  
  737.    public _FilterOn
  738. _FilterOn:
  739.    bclr #1,$bfe001
  740.    rts
  741.  
  742.    public _FilterOff
  743. _FilterOff:
  744.    bset #1,$bfe001
  745.    rts
  746. #endasm
  747.  
  748.  
  749. BOOL Start(num)
  750.  UWORD num;
  751. {
  752.  REGISTER UWORD              i,j;
  753.  REGISTER BOOL               okay,bool;
  754.  register struct FileHandle *fh;
  755.  
  756.  if(Catalog->Title[num][0]==0x00) return(FALSE);
  757.  WaitSymbol();
  758.  ShowSTitle();
  759.  okay=FALSE;
  760.  fh=Open(&Catalog->Title[num],MODE_OLDFILE);
  761.  if(fh!=NULL)
  762.   {
  763.    Seek(fh,0,OFFSET_END);
  764.    size=Seek(fh,0,OFFSET_BEGINNING);
  765.    mem=AllocMem(size,MEMF_CHIP|MEMF_CLEAR|MEMF_PUBLIC);
  766.    if(mem!=NULL)
  767.     {
  768.      Read(fh,mem,size);
  769.      Global.ChkData=mem;
  770.      Global.ChkSize=size;
  771.      Global.DirArrayPtr="DF2:";
  772.      Global.FileArrayPtr="Strings.smus";
  773.      Global.PathArrayPtr=&Catalog->Title[num];
  774.      bool=FALSE;
  775.      for(j=0;j<PlayerCnt;j++)
  776.       {
  777.        Tags=Segmente[j]->TagArray;
  778.        Check1=GetTagData(DPT_Check1,NULL,Tags);
  779.        Check2=GetTagData(DPT_Check2,NULL,Tags);
  780.        if(Check1!=NULL)
  781.         {
  782.          i=CallCheck1();
  783.          if(i==0) { bool=TRUE; break; }
  784.         }
  785.        if(Check2!=NULL)
  786.         {
  787.          i=CallCheck2();
  788.          if(i==0) { bool=TRUE; break; }
  789.         }
  790.        if((Check1==NULL)&&(Check2==NULL))
  791.         { bool=TRUE; break; }
  792.       }
  793.      if(bool==TRUE)
  794.       {
  795.        pname=GetTagData(DPT_PlayerName,"Unbekannt",Tags);
  796.        ShowPlayer();
  797.        InitPlayer=GetTagData(DPT_InitPlayer,NULL,Tags);
  798.        EndPlayer=GetTagData(DPT_EndPlayer,NULL,Tags);
  799.        InitSound=GetTagData(DPT_InitSound,NULL,Tags);
  800.        EndSound=GetTagData(DPT_EndSound,NULL,Tags);
  801.        Interrupt=GetTagData(DPT_Interrupt,NULL,Tags);
  802.        StartInt=GetTagData(DPT_StartInt,NULL,Tags);
  803.        StopInt=GetTagData(DPT_StopInt,NULL,Tags);
  804.        Check1=GetTagData(DPT_Check1,NULL,Tags);
  805.        Check2=GetTagData(DPT_Check2,NULL,Tags);
  806.        Volume=GetTagData(DPT_Volume,NULL,Tags);
  807.        i=0; if(InitPlayer) i=CallInitPlayer();
  808.        if(i==0)
  809.         {
  810.          PlaySymbol();
  811.          if((StartInt!=NULL)&&(StopInt!=NULL))
  812.           {
  813.            CallStartInt();
  814.            okay=TRUE;
  815.           }
  816.          else if((InitSound!=NULL)&&(EndSound!=NULL)&&(Interrupt!=NULL))
  817.           {
  818.            MyInt.is_Code=Interrupt;
  819.            CallInitSound();
  820.            AddIntServer(5,&MyInt);
  821.            okay=TRUE;
  822.           }
  823.         }
  824.       }
  825.      else
  826.       {
  827.        printf("Kein Player!\n");
  828.       }
  829.     }
  830.    Close(fh);
  831.   }
  832.  return(okay);
  833. }
  834.  
  835. VOID Stop()
  836. {
  837.  StopSymbol();
  838.  pname=NULL;
  839.  ShowPlayer();
  840.  if(mem!=NULL)
  841.   {
  842.    if((StartInt!=NULL)&&(StopInt!=NULL))
  843.     {
  844.      CallStopInt();
  845.      if(EndPlayer) CallEndPlayer();
  846.     }
  847.    else if((InitSound!=NULL)&&(EndSound!=NULL)&&(Interrupt!=NULL))
  848.     {
  849.      RemIntServer(5,&MyInt);
  850.      CallEndSound();
  851.     }
  852.    FilterOn();
  853.    FreeMem(mem,size);
  854.    mem=NULL;
  855.   }
  856. }
  857.  
  858. VOID LoadPlayer(name)
  859.  UBYTE *name;
  860. {
  861.  if(PlayerCnt<199)
  862.  Player[PlayerCnt]=LoadSeg(name);
  863.  if(Player[PlayerCnt]!=NULL)
  864.   {
  865.    Segmente[PlayerCnt]=BADDR(Player[PlayerCnt]);
  866.    PlayerCnt++;
  867.   }
  868.  else
  869.   {
  870.    printf("Fehler bei Player: %s\n",name);
  871.   }
  872. }
  873.  
  874. VOID UnLoadPlayers()
  875. {
  876.  REGISTER UWORD i;
  877.  
  878.  if(PlayerCnt>0)
  879.   {
  880.    for(i=0;i<PlayerCnt;i++)
  881.     {
  882.      UnLoadSeg(Player[i]);
  883.     }
  884.   }
  885. }
  886.  
  887. VOID PlaySymbol()
  888. {
  889.  if(HiFiPrefs.Filter!=0) FilterOn(); else FilterOff();
  890.  if(HCScreen!=NULL)
  891.   {
  892.    DrawCNBorder(HCWindow,35,5,50,35);
  893.    SetAPen(HCRPort,3);
  894.    Move(HCRPort,40,12);
  895.    Draw(HCRPort,40,32);
  896.    Draw(HCRPort,80,22);
  897.    Draw(HCRPort,40,12);
  898.   }
  899. }
  900.  
  901. VOID WaitSymbol()
  902. {
  903.  if(HCScreen!=NULL)
  904.   {
  905.    DrawCNBorder(HCWindow,35,5,50,35);
  906.    SetAPen(HCRPort,3);
  907.    Move(HCRPort,40,22);
  908.    Draw(HCRPort,80,22);
  909.   }
  910. }
  911.  
  912. VOID StopSymbol()
  913. {
  914.  if(HCScreen!=NULL)
  915.   {
  916.    DrawCNBorder(HCWindow,35,5,50,35);
  917.    SetAPen(HCRPort,3);
  918.    Move(HCRPort,40,12);
  919.    Draw(HCRPort,40,32);
  920.    Draw(HCRPort,80,32);
  921.    Draw(HCRPort,80,12);
  922.    Draw(HCRPort,40,12);
  923.   }
  924. }
  925.  
  926. VOID ShowSTitle()
  927. {
  928.  if(HCScreen!=NULL)
  929.   {
  930.    DrawCNBorder(HCWindow,90,5,520,16);
  931.    SetAPen(HCRPort,3);
  932.    WriteText(HCRPort,100,16,&Catalog->Title[current]);
  933.   }
  934. }
  935.  
  936. VOID ShowPlayer()
  937. {
  938.  if(HCScreen!=NULL)
  939.   {
  940.    DrawCNBorder(HCWindow,90,24,520,16);
  941.    if(pname!=NULL)
  942.     {
  943.      SetAPen(HCRPort,3);
  944.      WriteText(HCRPort,100,35,pname);
  945.     }
  946.   }
  947. }
  948.  
  949. VOID ShowVolume()
  950. {
  951.  REGISTER UWORD v;
  952.  
  953.  if(HCScreen!=NULL)
  954.   {
  955.    SetAPen(HCRPort,0);
  956.    RectFill(HCRPort,616,6,629,39);
  957.    v=(Global.SndVol*33)/64;
  958.    SetAPen(HCRPort,3);
  959.    RectFill(HCRPort,616,39-v,629,39);
  960.   }
  961. }
  962.  
  963. VOID HiFiControl()
  964. {
  965.  if(HCScreen==NULL)
  966.   {
  967.    HCScreen=OpenScreen(&HCScreenDef);
  968.    if(HCScreen!=NULL)
  969.     {
  970.      HCWindowDef.Screen=HCScreen;
  971.      HCWindow=OpenWindow(&HCWindowDef);
  972.      if(HCWindow!=NULL)
  973.       {
  974.        HCRPort=HCWindow->RPort;
  975.        HCViewPort=ViewPortAddress(HCWindow);
  976.        SetRGB4(HCViewPort,0,7,5,8);
  977.        SetRGB4(HCViewPort,1,13,13,13);
  978.        SetRGB4(HCViewPort,2,2,2,2);
  979.        SetRGB4(HCViewPort,3,15,15,5);
  980.        SetFont(HCRPort,opal);
  981.        ShowSTitle();
  982.        ShowPlayer();
  983.        DrawCNBorder(HCWindow,615,5,15,35);
  984.        if(play) PlaySymbol(); else StopSymbol();
  985.        ShowVolume();
  986.        return;
  987.       }
  988.     }
  989.   }  
  990.  if(HCWindow) CloseWindow(HCWindow);
  991.  if(HCScreen) CloseScreen(HCScreen);
  992.  HCScreen=NULL;
  993. }
  994.  
  995.  
  996. BOOL AuPrefs()
  997. {
  998.  UBYTE                        *defCat,*vol,*lbal,*rbal,str[10];
  999.  REGISTER UWORD                i,j;
  1000.  REGISTER ULONG                Class;
  1001.  REGISTER BOOL                 bool,ende;
  1002.  register struct Window       *win;
  1003.  register struct RastPort     *rp;
  1004.  register struct IntuiMessage *msg;
  1005.  register struct Gadget       *gad;
  1006.  struct Gadget                *filter,*astart,*aswait,*hctrl;
  1007.  register struct FileHandle   *fh;
  1008.  
  1009.  bool=FALSE;
  1010.  win=CreateStdWindow("HiFi-Player - Ausgabe-Einstellungen",
  1011.                      75,75,450,108,
  1012.                      CLOSEWINDOW|GADGETUP,
  1013.                      ACTIVATE|WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG);
  1014.  if(win!=NULL)
  1015.   {
  1016.    rp=win->RPort;
  1017.    SetFont(rp,opal);
  1018.    CreateBoolGadget(win,10,15,155,12,"Einstellungen Okay",1);
  1019.    CreateBoolGadget(win,170,15,155,12,"Programm beenden",2);
  1020.    CreateBoolGadget(win,335,15,50,12,"Info",3);
  1021.    CreateBoolGadget(win,390,15,50,12,"Hilfe",4);
  1022.    WriteText(rp,15,40,"Titel-Katalog bei Programmstart laden:");
  1023.    defCat=CreateStringGadget(win,10,45,430,10,&HiFiPrefs.DefaultCatalog,127,5);
  1024.    if(HiFiPrefs.Filter!=0)
  1025.      filter=CreateSToggleGadget(win,10,60,150,12,"Audio-Filter",6);
  1026.    else
  1027.      filter=CreateNToggleGadget(win,10,60,150,12,"Audio-Filter",6);
  1028.    if(HiFiPrefs.AutoPlaying!=0)
  1029.      astart=CreateSToggleGadget(win,175,60,130,12,"Auto-Start",7);
  1030.    else
  1031.      astart=CreateNToggleGadget(win,175,60,130,12,"Auto-Start",7);
  1032.    if(HiFiPrefs.AutoPlayingWait!=0)
  1033.      aswait=CreateSToggleGadget(win,310,60,130,12,"60 Sek. warten",8);
  1034.    else
  1035.      aswait=CreateNToggleGadget(win,310,60,130,12,"60 Sek. warten",8);
  1036.    CreateBoolGadget(win,10,75,150,12,"Player-Module",9);
  1037.    if(HiFiPrefs.Control!=0)
  1038.      hctrl=CreateSToggleGadget(win,10,90,150,12,"Kontrolldisplay",12);
  1039.    else
  1040.      hctrl=CreateNToggleGadget(win,10,90,150,12,"Kontrolldisplay",12);
  1041.    sprintf(&str,"%ld",HiFiPrefs.Volume);
  1042.    vol=CreateIntegerGadget(win,310,75,130,10,&str,3,10);
  1043.    WriteText(rp,180,83,"Lautstärke:");
  1044.    WriteText(rp,180,98,"Balance:");
  1045.    sprintf(&str,"%ld",HiFiPrefs.LBal);
  1046.    lbal=CreateIntegerGadget(win,310,91,60,10,&str,3,10);
  1047.    sprintf(&str,"%ld",HiFiPrefs.RBal);
  1048.    rbal=CreateIntegerGadget(win,380,91,60,10,&str,3,10);
  1049.    ende=FALSE;
  1050.    while(ende==FALSE)
  1051.     {
  1052.      WaitPort(win->UserPort);
  1053.      msg=GTGetIMsg(win->UserPort);
  1054.      Class=msg->Class;
  1055.      gad=msg->IAddress;
  1056.      GTReplyIMsg(msg);
  1057.      switch(Class)
  1058.       {
  1059.        case CLOSEWINDOW:
  1060.          ende=TRUE;
  1061.         break;
  1062.        case GADGETUP:
  1063.          switch(gad->GadgetID)
  1064.           {
  1065.            case 1:
  1066.              fh=Open(HiFiPrefsName,MODE_NEWFILE);
  1067.              if(fh!=NULL)
  1068.               {
  1069.                i=atol(vol);
  1070.                if(i>64) i=64;
  1071.                HiFiPrefs.Volume=i;
  1072.                i=atol(lbal);
  1073.                if(i>64) i=64;
  1074.                HiFiPrefs.LBal=i;
  1075.                i=atol(rbal);
  1076.                if(i>64) i=64;
  1077.                HiFiPrefs.RBal=i;
  1078.                if(hctrl->Flags & SELECTED) HiFiPrefs.Control=1; else HiFiPrefs.Control=0;
  1079.                if(filter->Flags & SELECTED) HiFiPrefs.Filter=1; else HiFiPrefs.Filter=0;
  1080.                if(astart->Flags & SELECTED) HiFiPrefs.AutoPlaying=1; else HiFiPrefs.AutoPlaying=0;
  1081.                if(aswait->Flags & SELECTED) HiFiPrefs.AutoPlayingWait=1; else HiFiPrefs.AutoPlayingWait=0;
  1082.                strcpy(&HiFiPrefs.DefaultCatalog,defCat);
  1083.                Write(fh,&HiFiPrefs,sizeof(struct HiFiPrefs));
  1084.                Close(fh);
  1085.               }
  1086.              ende=TRUE;
  1087.             break;
  1088.            case 2:
  1089.              ende=bool=TRUE;
  1090.             break;
  1091.            case 3:
  1092.              ShowInfo();
  1093.             break;
  1094.            case 4:
  1095.              Help(HelpName,0);
  1096.             break;
  1097.            case 9:
  1098.              PlayerPrefs();
  1099.             break;
  1100.           }
  1101.         break;
  1102.       }
  1103.     }
  1104.    DeleteStdWindow(win);
  1105.   }
  1106.  return(bool);
  1107. }
  1108.  
  1109.  
  1110. VOID PlayerPrefs()
  1111. {
  1112.  REGISTER UWORD                i,j;
  1113.  REGISTER ULONG                Class;
  1114.  REGISTER BOOL                 ende;
  1115.  register struct Window       *win;
  1116.  register struct RastPort     *rp;
  1117.  register struct IntuiMessage *msg;
  1118.  register struct Gadget       *gad;
  1119.  
  1120.  win=CreateStdWindow("HiFi-Player - Player-Einstellungen",
  1121.                      25,25,580,150,
  1122.                      CLOSEWINDOW|GADGETUP,
  1123.                      WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG|ACTIVATE);
  1124.  if(win!=NULL)
  1125.   {
  1126.    rp=win->RPort;
  1127.    SetFont(rp,GetOpalFont());
  1128.    CreateBoolGadget(win,10,15,165,12,"Einstellungen okay",1);
  1129.    CreateBoolGadget(win,210,15,175,12,"Player hinzufügen",2);
  1130.    CreateBoolGadget(win,395,15,175,12,"Player löschen",3);
  1131.    DrawNBorder(win,210,30,330,115);
  1132.    CreatePropGadget(win,545,30,25,115,0,0,0,65535,8);
  1133.    SelectStdFPen(rp);
  1134.    WriteText(rp,10,45,"Name:");
  1135.    DrawNBorder(win,10,50,180,12);
  1136.    WriteText(rp,10,80,"Version:");
  1137.    DrawNBorder(win,10,85,180,12);
  1138.  
  1139.    ende=FALSE;
  1140.    while(ende==FALSE)
  1141.     {
  1142.      WaitPort(win->UserPort);
  1143.      msg=GTGetIMsg(win->UserPort);
  1144.      Class=msg->Class;
  1145.      gad=msg->IAddress;
  1146.      GTReplyIMsg(msg);
  1147.      switch(Class)
  1148.       {
  1149.        case CLOSEWINDOW:
  1150.          ende=TRUE;
  1151.         break;
  1152.        case GADGETUP:
  1153.         break;
  1154.       }
  1155.     }
  1156.    DeleteStdWindow(win);
  1157.   }
  1158. }
  1159.  
  1160.  
  1161. VOID TitleEd()
  1162. {
  1163.  UBYTE                         show[10];
  1164.  UBYTE                         select[MAXTITLES];
  1165.  REGISTER UBYTE                StdPen;
  1166.  REGISTER UWORD                i,j,k;
  1167.  REGISTER ULONG                Class;
  1168.  REGISTER BOOL                 ende,bool;
  1169.  register struct Window       *win;
  1170.  register struct RastPort     *rp;
  1171.  register struct IntuiMessage *msg;
  1172.  register struct Gadget       *gad,*prop;
  1173.  register struct PropInfo     *pi;
  1174.  
  1175.  win=CreateStdWindow("HiFi-Player - Titeleditor",
  1176.                      25,25,580,150,
  1177.                      CLOSEWINDOW|GADGETUP,
  1178.                      WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG|ACTIVATE);
  1179.  if(win!=NULL)
  1180.   {
  1181.    rp=win->RPort;
  1182.    SetFont(rp,GetOpalFont());
  1183.    CreateBoolGadget(win,10,15,165,12,"Einstellungen okay",1);
  1184.    CreateBoolGadget(win,210,15,150,12,"Titel hinzufügen",2);
  1185.    CreateBoolGadget(win,370,15,150,12,"Titel löschen",3);
  1186.    CreateBoolGadget(win,525,15,50,12,"Neu",9);
  1187.    if(Catalog->Entries<=10) j=1; else j=Catalog->Entries-10;
  1188.    prop=CreatePropGadget(win,545,30,25,115,0,0,0,65535/j,4);
  1189.    pi=prop->SpecialInfo;
  1190.    SelectStdFPen(rp);
  1191.    StdPen=rp->FgPen;
  1192.    for(i=0;i<Catalog->Entries;i++) select[i]=StdPen;
  1193.    for(   ;i<MAXTITLES;i++) select[i]=0;
  1194.    for(i=0;i<10;i++) show[i]=i;
  1195.    i=32; k=0;
  1196.    for(j=1000;j<1010;j++)
  1197.     {
  1198.      CreateMinGadget(win,11,i,528,12,j);
  1199.      WriteText(rp,15,i+8,&Catalog->Title[k]);
  1200.      i+=11; k++;
  1201.     }
  1202.    DrawNBorder(win,10,30,530,115);
  1203.  
  1204.    k=0;
  1205.    ende=FALSE;
  1206.    while(ende==FALSE)
  1207.     {
  1208.      WaitPort(win->UserPort);
  1209.      msg=GTGetIMsg(win->UserPort);
  1210.      Class=msg->Class;
  1211.      gad=msg->IAddress;
  1212.      GTReplyIMsg(msg);
  1213.      switch(Class)
  1214.       {
  1215.        case CLOSEWINDOW:
  1216.          ende=TRUE;
  1217.         break;
  1218.        case GADGETUP:
  1219.          switch(gad->GadgetID)
  1220.           {
  1221.            case 1:
  1222.              ende=TRUE;
  1223.             break;
  1224.            case 2:
  1225.              ReqTags[1].Data=FILF_PATGAD|FILF_MULTISELECT;
  1226.              if((AslRequest(FileReq,ReqTags)))
  1227.               {
  1228.                j=FileReq->rf_NumArgs;
  1229.                if(j>0)
  1230.                 {
  1231.                  fargs=FileReq->rf_ArgList;
  1232.                  while(j--)
  1233.                   {
  1234.                    if(Catalog->Entries<MAXTITLES)
  1235.                     {
  1236.                      lock=fargs->wa_Lock;
  1237.                      NameFromLock(lock,&dir,80);
  1238.                      i=strlen(&dir)-1;
  1239.                      if(dir[i]!=':') { dir[i+1]='/'; dir[i+2]=0x00; }
  1240.                      strcpy(&Catalog->Title[Catalog->Entries],&dir);
  1241.                      strcat(&Catalog->Title[Catalog->Entries],fargs->wa_Name);
  1242.                      Catalog->Entries++;
  1243.                     } else DisplayBeep(NULL);
  1244.                    fargs++;
  1245.                   }
  1246.                  for(i=0;i<Catalog->Entries;i++) select[i]=StdPen;
  1247.                  for(   ;i<MAXTITLES;i++) select[i]=0;
  1248.                  for(i=0;i<10;i++) show[i]=i;
  1249.                  i=32;
  1250.                  DrawCNBorder(win,10,30,530,115);
  1251.                  for(k=0;k<10;k++)
  1252.                   {
  1253.                    if(k<Catalog->Entries)
  1254.                     {
  1255.                      WriteText(rp,15,i+8,&Catalog->Title[k]);
  1256.                      i+=11;
  1257.                     } else break;
  1258.                   }
  1259.                  if(Catalog->Entries<=10) j=1; else j=Catalog->Entries-10;
  1260.                  ModifyProp(prop,win,NULL,
  1261.                             PROPBORDERLESS|FREEVERT|AUTOKNOB,
  1262.                             0,0,0,65535/j);
  1263.                 }
  1264.               }
  1265.             break;
  1266.            case 9:
  1267.              bool=MultiRequest("Wollen Sie wirklich alle einen neuen",
  1268.                                "Katalog erstellen?",
  1269.                                "Ja, Erstellen","Nein, Abbruch");
  1270.              if(bool==TRUE)
  1271.               {
  1272.                bool=MultiRequest("Wollen Sie eventuelle Änderungen im aktuellen",
  1273.                                  "Titelkatalog abspeichern oder verwerfen?",
  1274.                                  "Abspeichern","Verwerfen");
  1275.                if(bool==TRUE) SaveCatalog();
  1276.                k=0;
  1277.                DrawCNBorder(win,10,30,530,115);
  1278.                for(i=0;i<Catalog->Entries;i++) select[i]=StdPen;
  1279.                for(   ;i<MAXTITLES;i++) select[i]=0;
  1280.                for(i=0;i<10;i++) show[i]=i;
  1281.                for(i=0;i<MAXTITLES;i++) Catalog->Title[i][0]=0x00;
  1282.                ModifyProp(prop,win,NULL,
  1283.                           PROPBORDERLESS|FREEVERT|AUTOKNOB,
  1284.                           0,0,0,65535);
  1285.               }
  1286.             break;
  1287.            case 3:
  1288.              bool=MultiRequest("Wollen Sie wirklich alle gewählten",
  1289.                                "Titel aus dem Katalog löschen?",
  1290.                                "Ja, Löschen","Nein, Abbruch");
  1291.              if(bool==TRUE)
  1292.               {
  1293.                j=0;
  1294.                for(i=0;i<Catalog->Entries;i++)
  1295.                 {
  1296.                  if(select[i]!=3)
  1297.                   {
  1298.                    strcpy(&Cat2->Title[j],&Catalog->Title[i]); j++;
  1299.                   }
  1300.                 }
  1301.                Cat2->Entries=j;
  1302.                for(   ;j<MAXTITLES;j++) Cat2->Title[j][0]=0x00;
  1303.                CopyMem(Cat2,Catalog,CATSIZE);
  1304.                DrawCNBorder(win,10,30,530,115);
  1305.                for(i=0;i<Catalog->Entries;i++) select[i]=StdPen;
  1306.                for(   ;i<MAXTITLES;i++) select[i]=0;
  1307.                for(i=0;i<10;i++) show[i]=i;
  1308.                i=32;
  1309.                for(k=0;k<10;k++)
  1310.                 {
  1311.                  if(k<Catalog->Entries)
  1312.                   {
  1313.                    WriteText(rp,15,i+8,&Catalog->Title[k]);
  1314.                    i+=11;
  1315.                   } else break;
  1316.                 }
  1317.                if(Catalog->Entries<=10) j=1; else j=Catalog->Entries-10;
  1318.                ModifyProp(prop,win,NULL,
  1319.                           PROPBORDERLESS|FREEVERT|AUTOKNOB,
  1320.                           0,0,0,65535/j);
  1321.               }
  1322.             break;
  1323.            case 4:
  1324.              if(Catalog->Entries>10)
  1325.               {
  1326.                j=pi->VertPot/(65535/(Catalog->Entries-10));
  1327.                if(j!=k)
  1328.                 {
  1329.                  k=j;
  1330.                  DrawCNBorder(win,10,30,530,115);
  1331.                  for(i=0;i<10;i++)
  1332.                   {
  1333.                    show[i]=k+i;
  1334.                    SetAPen(rp,select[show[i]]);
  1335.                    WriteText(rp,15,40+(i*11),&Catalog->Title[k+i]);
  1336.                   }
  1337.                 }
  1338.               }
  1339.             break;
  1340.            default:
  1341.              if((gad->GadgetID>=1000)&&(gad->GadgetID<1010))
  1342.               {
  1343.                j=gad->GadgetID-1000;
  1344.                if(select[show[j]]!=0)
  1345.                 {
  1346.                  if(select[show[j]]!=3)
  1347.                    select[show[j]]=3;
  1348.                  else
  1349.                    select[show[j]]=StdPen;
  1350.                  SetAPen(rp,select[show[j]]);
  1351.                  WriteText(rp,15,40+(j*11),&Catalog->Title[show[j]]);
  1352.                 }
  1353.               }
  1354.             break;
  1355.           }
  1356.         break;
  1357.       }
  1358.     }
  1359.    DeleteStdWindow(win);
  1360.   }
  1361. }
  1362.  
  1363.